<template>
	<v-Content>
	<mt-loadmore :top-method="loadTop" :bottom-method="loadBottom" :bottom-all-loaded="allLoaded" ref="loadmore" :autoFill="false">
		<div class="" v-for="(i,index) in getScoreLog">
			<v-FundArrowList :item=i></v-FundArrowList>
		</div>
		
	</mt-loadmore>
	<div class="footer" v-show="getScoreLog.length==0">
			<img src="../../assets/default_record.png"/>
			<p>暂无内容</p>
	</div>
	</v-Content>
</template>

<script>
	import FundArrowList from '@/components/FundArrowList'
	import {Loadmore} from 'mint-ui'
	import my from '@/api/my/index'
	import Content from '@/components/ContentAll'
	export default{
		data(){
			return{
				getScoreLog: [],     //总数
		        pageNo: 1,           //页数
		        allLoaded: false,    //
		        bottomText: '上拉加载更多...',
		        totalPage: '',       //总共
		        scrollMode:"touch",// iphone或安卓机存在问题
			}
		},
		
    	components: {
	        'v-FundArrowList': FundArrowList,
	        'mt-loadmore':Loadmore,
	        'v-Content': Content,
    	},
    	methods:{
    		getData(){
    			let senddata = {
					page:this.pageNo,
					type:3,
					userId:window.localStorage.getItem("token"),
					plat:"mlj"
				}
				my.accountLogJson(senddata).then(res=>{
		            if(res.data.code==200){
		               	this.getScoreLog = res.data.data.list;
		               	this.totalPage=res.data.data.totalPage;
		            } else if(res.data.code==222){
		                this.$router.push({path:'/login'})
		            }else{
		            	 console.log(res);
		            }
		      	})
    		},
    		loadTop() {
			  	this.$refs.loadmore.onTopLoaded();
			},
    		loadBottom() {
		        this.pageNo += 1;
		        if (this.pageNo == this.totalPage) {
		          this.allLoaded = true;
		        }
		        setTimeout(() => {
			        let senddata = {
						page:this.pageNo,
						type:3,
						userId:window.localStorage.getItem("token"),
						plat:"mlj"
					}
					my.accountLogJson(senddata).then(res=>{
			            if(res.data.code==200){
			                this.getScoreLog = this.getScoreLog.concat(res.data.data.list);
			                this.$refs.loadmore.onBottomLoaded();
			            } else{
			            	 console.log(res);
			            }
			      	})
		        }, 1500);
		    },
		    loadBottomUse(){
		    	console.log("上拉刷新");
		    },
    	},
    	mounted(){
	  		this.getData();
	  		
		}
	}
</script>
<style lang="less" scoped>
	@import '../../less/config.less';
	
	.footer{
		text-align: center;
		color: @Color;
		font-size: @f28;
		margin-top: 4rem;
		margin-top: 2.5rem;
			display: flex;
			color: #0296af;
			justify-content: center;
			align-items: center;
			flex-direction: column;
			p{
				color: #0296af;
			}
	}
	
	
</style>